{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
	<h3 class="pb-3">新增员工</h3>
    <table class="layui-table layui-table-form">
      <tr>
          <td class="layui-td-gray">员工名称<font>*</font></td>
          <td><input type="text" name="name" lay-verify="required" {notempty name="$detail.name"}value="{$detail.name}" {/notempty} lay-reqText="请输入员工名称" autocomplete="off" placeholder="请输入员工名称" class="layui-input"></td>
          {if condition="$eid gt 0"}
            <input type="hidden" name="eid" value="{$eid}" lay-verify="required">
          {else/}
            <td class="layui-td-gray">所在企业<font>*</font></td>
            <td colspan="5">
                <select name="eid" lay-verify="required" lay-reqText="请选择所属企业">
                    <option value="0">系统管理员</option>
                    {volist name="enterprise" id="v"}
                    <option value="{$v.id}" {notempty name="$detail.eid"}{eq name="$v.id" value="$detail.eid"} selected{/eq}{/notempty} >{$v.title}</option>
                    {/volist}
                </select>
            </td>
          {/if}
        </td>
      </tr>
        <tr>
            <td class="layui-td-gray">开始时间<font>*</font></td>
            <td>
                <input id="start_time" name="start_time" autocomplete="off" {notempty name="$detail.fmt_start_time"}value="{$detail.fmt_start_time}" {/notempty} class="layui-input" value="" readonly lay-verify="required" placeholder="请选择开始时间" lay-reqText="请选择开始时间">
            </td>
            <td class="layui-td-gray">结束时间<font>*</font></td>
            <td>
                <input id="end_time" name="end_time" autocomplete="off" class="layui-input" {notempty name="$detail.fmt_end_time"}value="{$detail.fmt_end_time}" {/notempty} readonly lay-verify="required" placeholder="请选择结束时间" lay-reqText="请选择结束时间">
            </td>
        </tr>
        </tr>
        <tr>
            <td class="layui-td-gray">员工类型<font>*</font></td>
            <td colspan="3">
                <input type="text" name="type" lay-verify="required" {notempty name="$detail.type"}value="{$detail.type}" {/notempty} lay-reqText="请输入员工类型" autocomplete="off" placeholder="请输入员工类型" class="layui-input"></td>
            </td>
        </tr>
        <tr>
            <td class="layui-td-gray">员工类型<font>*</font></td>
            <td colspan="3">
                <input type="text" name="type" lay-verify="required" {notempty name="$detail.type"}value="{$detail.type}" {/notempty} lay-reqText="请输入员工类型" autocomplete="off" placeholder="请输入员工类型" class="layui-input"></td>
            </td>
        </tr>
        <input type="hidden" name="id" ,  {notempty name="$detail.id"}value="{$detail.id}" {/notempty} >
    </table>
    <div class="py-3">
	   <input type="hidden" name="scene" value="add">
      <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
</form>
{/block}
<!-- /主体 -->

<!-- 脚本 -->
{block name="script"}
<script>
	const moduleInit = ['tool','employeepicker'];
	function gouguInit() {
		var form = layui.form,tool=layui.tool,employeepicker = layui.employeepicker;
		
		//监听提交
		form.on('submit(webform)', function (data) {
			let callback = function (e) {
				layer.msg(e.msg);
				if (e.code == 0) {
					tool.sideClose(1000);
				}
			}
			tool.post("/home/item/add", data.field, callback);
			return false;
		});

        var form = layui.form,
            tool=layui.tool,
            oaTool=layui.oaTool,
            laydate = layui.laydate;
        //日期时间范围
        laydate.render({
            elem: '#start_time',
            type: 'date',
            format: 'yyyy-MM-dd',
            showBottom: false
        });
        //日期时间范围
        laydate.render({
            elem: '#end_time',
            type: 'date',
            format: 'yyyy-MM-dd',
            showBottom: false
        });

    }
</script>
{/block}
<!-- /脚本 -->